﻿@Html.DevExpress().GridView(
    settings =>
    {
        settings.Name = "MembersGridView";
        settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
        settings.CallbackRouteValues = new { Controller = "ManagerADGroup", Action = "MembersGridView" };
        settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "ManagerADGroup", Action = "DeleteMember", GroupName = Model.Name };
        
        var operationsColumn = new MVCxGridViewCommandColumn { Caption = "Options" };

        settings.Columns.Add(operationsColumn);
        operationsColumn.Width = System.Web.UI.WebControls.Unit.Pixel(96);
        operationsColumn.DeleteButton.Visible = true;
        operationsColumn.DeleteButton.Text = "Remove";
        operationsColumn.Visible = true;

        settings.Columns.Add(col =>
            {
                col.FieldName = "Name";
                col.Caption = "Members";
                col.ColumnType = MVCxGridViewColumnType.ComboBox;

                ComboBoxProperties comboProperties = col.PropertiesEdit as ComboBoxProperties;
                comboProperties.DataSource = ViewBag.Managers;
                col.EditFormSettings.Visible = DefaultBoolean.True;
            });

        settings.SettingsEditing.Mode = GridViewEditingMode.Inline;
        settings.KeyFieldName = "Name";

    }).Bind(Model.Members).GetHtml()